import { ElMessage } from 'element-plus';

// 封装ElMessage，确保每次调用都带有关闭按钮
const message = {
    success(message, options = {}) {
        return ElMessage({
            type: 'success',
            message,
            showClose: true,
            duration: 7000,
            ...options
        });
    },

    warning(message, options = {}) {
        return ElMessage({
            type: 'warning',
            message,
            showClose: true,
            duration: 7000,
            ...options
        });
    },

    info(message, options = {}) {
        return ElMessage({
            type: 'info',
            message,
            showClose: true,
            duration: 7000,
            ...options
        });
    },

    error(message, options = {}) {
        return ElMessage({
            type: 'error',
            message,
            showClose: true,
            duration: 7000,
            ...options
        });
    },

    // 原始方法，为了完整性保留
    closeAll() {
        ElMessage.closeAll();
    }
};

export default message; 